
package JET.Centers;

import JET.MouseStuff.*;
import JET.geom.*;
import java.awt.Cursor;
import java.awt.event.MouseEvent;
import java.util.HashMap;
import javax.swing.JPanel;

/**
 *
 * @author 057Ry
 */
public class MouseCenter {

    static final ControlCenter CC = ControlCenter.getInstance();

     // zmienne do sterowania myszka w gui dla graphic panelu
    private MouseOTFMode mouseOTFMode;
    private MouseOTFSubMode mouseOTFSubMode;
    private MouseMode mouseMode;
    private MouseSubMode mouseSubMode;
    private HashMap mouseModeAlts = new HashMap();

    public MouseEvent mouseEvent;
    public Object mouseObject1, mouseObject2, mouseObject3;
    public Vec2d mouseVec;
    public Vec2d mouseVec2;
    public int mouseInteger = 3;
    public Cursor mouseLastCursor;

    // zmienne do obslugi myszy - aktualizowane automatycznie w graphicPanelMouseMotionListener
    public Vec2d mouseLastPos;
    public Vec2d mouseMoveVec;
    public Vec2d mouseLastPosOnScreen;

    // zmienne do skalowania GP
    public Vec2d lastEngineMousePos;
    public Vec2d lastMonitorMousePos;

    private MouseModeSequence mouseModeSequence;

    // TODO: move this cration stuff somewhere else
    // zmienne do dodawania okregu  (create circle)
    public boolean createCircleCenterPoint      = true;
    public boolean createCircleDoubleSprings    = true; // ma znaczenie tylko gdy createCenterPoint=true
    public boolean createCircleWalls            = true;
    // zmienne do dodawania squareNet (create squarenet)
    public boolean createSquareNetDoubleSprings = true;

    public enum BodyType {
        Spring,
        Rigid
    }

    public BodyType bodyType;

    public MouseCenter() {
        mouseOTFMode = MouseOTFMode.DO_NOTHING;
        mouseOTFSubMode = mouseOTFSubMode.DO_NOTHING;
        mouseMode = MouseMode.DO_NOTHING;
        mouseSubMode = mouseSubMode.DO_NOTHING;
        mouseLastPos = new Vec2d();
        mouseMoveVec = new Vec2d();
        mouseLastPosOnScreen = new Vec2d();
        mouseEvent = new MouseEvent(new JPanel(), 1, 1, 1, 1, 1, 1, false);

        mouseModeSequence = new MouseModeSequence();

        lastEngineMousePos = new Vec2d();
        lastMonitorMousePos = new Vec2d();
    }

    public void setMouseOTFMode(MouseOTFMode mouseOTFMode)
    {
        this.mouseOTFMode = mouseOTFMode;
    }
    public void setMouseOTFSubMode(MouseOTFSubMode mouseOTFSubMode)
    {
        this.mouseOTFSubMode = mouseOTFSubMode;
    }
    public void setMouseMode(MouseMode mouseMode) {
        this.mouseMode = mouseMode;
        CC.GUIC.setMouseModeLabel("mouse mode: "+mouseMode);
    }

    public MouseMode getMouseMode() {
        return mouseMode;
    }
    public MouseSubMode getMouseSubMode() {
        return mouseSubMode;
    }
    public MouseOTFMode getMouseOTFMode() {
        return mouseOTFMode;
    }
    public MouseModeAlt getMouseModeAlt(MouseMode mm) {
        return (MouseModeAlt) mouseModeAlts.get(mm);
    }
    public MouseModeSequence getMouseModeSequence() {
        return mouseModeSequence;
    }

    public void setMouseSubMode(MouseSubMode msm) {
        this.mouseSubMode = msm;
    }

    public void setMouseModeAlt(MouseMode mm, MouseModeAlt mma) {
        mouseModeAlts.remove(mm);
        mouseModeAlts.put(mm, mma);
    }

}
